<template>
  <div class="ht-search-form">
    <div v-if="state.dataSource.length == 0">
      <MyTemp>暂无验度明细哦~</MyTemp>
    </div>

    <div v-else>
      <p class="ht-form-title">验度明细</p>

      <ht-table
        class="ht-table-no-border"
        :data="state.dataSource"
        style="width: 100%; margin-top: 12px"
        border
        :hide-order="true"
        :hide-page="true"
        highlight-current-row
        :columns="columns"
      >
        <template slot="creationTime" slot-scope="{ row }">
          <span> {{ row.creationTime?.replace('T', ' ').slice(0, 16) }}</span>
        </template>
        <template slot="containerType" slot-scope="{ row }">
          {{ row.sapCode == state.exportNumber ? '移出' : '移入' }}
        </template>
        <template slot="sapName" slot-scope="{ row }">
          {{ row.sapName || '--' }}
        </template>

        <template slot="alcoholicity" slot-scope="{ row }">
          {{ row.alcoholicity ? row.alcoholicity + ' vol%' : '--' }}
        </template>

        <template slot="wineTemperature" slot-scope="{ row }">
          {{ row.wineTemperature ? row.wineTemperature + ' ℃' : '--' }}
        </template>

        <template slot="creatorId" slot-scope="{ row }">
          <ht-select-user
            :readonly="true"
            v-if="row.creatorId"
            :value="row.creatorId"
          ></ht-select-user>
        </template>
      </ht-table>
    </div>
  </div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import MyTemp from './myTemp.vue';

import { Column } from 'htui-yllkbz/src/packages/type';
interface State {
  /** 数据状态 */

  loading: boolean;

  dataSource: any;
  exportNumber: string;
  testData: any;
}
@Component({
  components: {
    MyTemp,
  },
})
export default class Index extends Vue {
  /** 数据 */
  @Prop() wineTestRecords!: any;
  state: State = {
    loading: false,
    exportNumber: '',

    dataSource: [],
    testData: [],
  };
  /** 生命周期 */
  initData() {
    this.state.dataSource = this.wineTestRecords;
  }
  // 构建数据

  /** 方法 */
  // 自动补0

  /** 监听 */
  /** 计算属性 */
  /** 计算属性 */
  get columns(): Column[] {
    return [
      { key: 'containerType', title: '类型' },
      // { key: 'factoryName', title: '厂区' },
      // //
      // { key: 'wareHouseName', title: '酒库' },
      { key: 'sapName', title: '容器' },

      { key: 'sapCode', title: '容器编号' },

      // { key: 'wineBreedName', title: '酒品名称' },
      // { key: 'wineBreedCode', title: '酒品代码' },
      // { key: 'manuDate', title: '生产年月' },
      //

      //

      { key: 'alcoholicity', title: '酒度' },
      { key: 'wineTemperature', title: '温度' },
      // { key: 'alcoholproof', title: '标准酒度' },
      { key: 'creatorId', title: '验度人' },
      { key: 'creationTime', title: '验度时间' },
    ];
  }
}
</script>
<style lang="scss" scoped></style>
